/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.biodas.jdas.creators;

import java.math.BigInteger;
import java.util.List;
import org.biodas.jdas.schema.entryPoints.DASEP;
import org.biodas.jdas.schema.entryPoints.ENTRYPOINTS;
import org.biodas.jdas.schema.entryPoints.ObjectFactory;
import org.biodas.jdas.schema.entryPoints.SEGMENT;

/**
 * Helper class to build Entry_points objects, see TestCreateEntryPoints for example usage 
 * @author jw12
 */
public class CreateEntryPoints {
    ObjectFactory factory = new ObjectFactory();
   
    
    
    
    /**
     * Create an EntryPoints document representation from a list of segments - see TestCreateEntryPoints for example usage 
     * @param version
     * @param href
     * @param totalEntryPoints
     * @param firstInList
     * @param lastInList
     * @param segments
     * @return 
     */
    public DASEP createEntryPoints(String version, String href, BigInteger totalEntryPoints, BigInteger firstInList, BigInteger lastInList, List<SEGMENT> segments){
        ENTRYPOINTS eps = factory.createENTRYPOINTS();
        eps.setVersion(version);
        eps.setHref(href);
        eps.setStart(firstInList);
        eps.setEnd(lastInList);
        eps.setTotal(totalEntryPoints);
        eps.getContent().addAll(segments);
        return this.createDASEP(eps);
    }
    /**
     * create a segment - basic version with most often used attributes can create an object directly using the JAXB generated factory if need orientation and version etc
     * @param id e.g. 1 to indicate chromosome 1
     * @param type e.g. chromosome
     * @param start start base 
     * @param stop stop base - i.e. usual equates to the length of the segment
     * @return 
     */
    public SEGMENT createSegment(String id, String type, BigInteger start, BigInteger stop){
        SEGMENT segment=factory.createSEGMENT();
        segment.setId(id);
        segment.setType(type);
        segment.setStart(start);
        segment.setStop(stop);
        return segment;
    }
    
    public DASEP createDASEP(ENTRYPOINTS entryPoints){
        DASEP dasEp=factory.createDASEP();
        dasEp.setENTRYPOINTS(entryPoints);
        return dasEp;
    }
    
}
